RequireScript("util.js");
RequireScript("effect.js");
RequireScript("player_menu.js");
RequireScript("inventory.js");
var log = OpenLog("UpdateTest.log");
log.write("Game Log Started");

function update_map()
{
	log.write("Update Triggered");
    while(AreKeysLeft()) {
        switch(GetKey()) {
            case KEY_P:
                log.write("Menu Opened");
                RenderMenu();
            break;
            case KEY_I:
            var items = new Inv();
						  items.addItem("Bow", "bow.png");
							items.addItem("Arrow", "arrow.png");
							if(GetPersonValue("player","gotten"))
								items.addItem("Blue Stone", "stone.png");
							items.openInventory();
						break;
								
        }
    }
}
function loadMap(map)
{
    var f = GetSystemFont();
    CreatePerson("player", "test.rss", false);
    SetPersonSpeed("player",2);
    AttachInput("player");
    AttachCamera("player");
    RequireScript("talk.js");
    SetDefaultMapScript(SCRIPT_ON_ENTER_MAP,"fadeIn()");
    //SetDefaultMapScript(SCRIPT_ON_LEAVE_MAP,"fadeOut()");
    SetUpdateScript("update_map();");
    MapEngine(map, 60);
    var col = CreateColor(0,0,0);
    Rectangle(0,0,150,16,col);
    f.drawText(0,0,"Press any key to exit.");
    FlipScreen();
    GetKey();
}
	